package com.yituo.mjworld.mvc.entity.web;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

@Entity
@Table(name = "transaction_log", schema = "web_mojianworld_server", catalog = "")
public class TransactionLog {
  /**
   * 支付方式_微信支付
   */
  public static final int WAY_WX_PAY = 1;
  /**
   * 支付方式_支付宝支付
   */
  public static final int WAY_ALI_PAY = 2;

  private String transactionId;
  private String userId;
  private String userNote;
  private BigDecimal amount;
  private int payWay;
  private int status;
  private Date createDate;
  private Date updateDate;
  private Integer transportId;
  private Integer transportStatus;

  @Id
  @Column(name = "transactionId", nullable = false, length = 36)
  public String getTransactionId() {
    return transactionId;
  }

  public void setTransactionId(String transactionId) {
    this.transactionId = transactionId;
  }

  @Basic
  @Column(name = "userId", nullable = false, length = 36)
  public String getUserId() {
    return userId;
  }

  public void setUserId(String userId) {
    this.userId = userId;
  }

  @Basic
  @Column(name = "userNote", nullable = true, length = 200)
  public String getUserNote() {
    return userNote;
  }

  public void setUserNote(String userNote) {
    this.userNote = userNote;
  }

  @Basic
  @Column(name = "amount", nullable = false, precision = 2)
  public BigDecimal getAmount() {
    return amount;
  }

  public void setAmount(BigDecimal amount) {
    this.amount = amount;
  }

  @Basic
  @Column(name = "payWay", nullable = false)
  public int getPayWay() {
    return payWay;
  }

  public void setPayWay(int payWay) {
    this.payWay = payWay;
  }

  @Basic
  @Column(name = "status", nullable = false)
  public int getStatus() {
    return status;
  }

  public void setStatus(int status) {
    this.status = status;
  }

  @Basic
  @Column(name = "createDate", nullable = false)
  public Date getCreateDate() {
    return createDate;
  }

  public void setCreateDate(Date createDate) {
    this.createDate = createDate;
  }

  @Basic
  @Column(name = "updateDate", nullable = false)
  public Date getUpdateDate() {
    return updateDate;
  }

  public void setUpdateDate(Date updateDate) {
    this.updateDate = updateDate;
  }

  @Basic
  @Column(name = "transportId", nullable = true)
  public Integer getTransportId() {
    return transportId;
  }

  public void setTransportId(Integer transportId) {
    this.transportId = transportId;
  }

  @Basic
  @Column(name = "transportStatus", nullable = true)
  public Integer getTransportStatus() {
    return transportStatus;
  }

  public void setTransportStatus(Integer transportStatus) {
    this.transportStatus = transportStatus;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    TransactionLog that = (TransactionLog) o;

    if (payWay != that.payWay) return false;
    if (status != that.status) return false;
    if (transactionId != null ? !transactionId.equals(that.transactionId) : that.transactionId != null) return false;
    if (userId != null ? !userId.equals(that.userId) : that.userId != null) return false;
    if (userNote != null ? !userNote.equals(that.userNote) : that.userNote != null) return false;
    if (amount != null ? !amount.equals(that.amount) : that.amount != null) return false;
    if (createDate != null ? !createDate.equals(that.createDate) : that.createDate != null) return false;
    if (updateDate != null ? !updateDate.equals(that.updateDate) : that.updateDate != null) return false;
    if (transportId != null ? !transportId.equals(that.transportId) : that.transportId != null) return false;
    if (transportStatus != null ? !transportStatus.equals(that.transportStatus) : that.transportStatus != null)
      return false;

    return true;
  }

  @Override
  public int hashCode() {
    int result = transactionId != null ? transactionId.hashCode() : 0;
    result = 31 * result + (userId != null ? userId.hashCode() : 0);
    result = 31 * result + (userNote != null ? userNote.hashCode() : 0);
    result = 31 * result + (amount != null ? amount.hashCode() : 0);
    result = 31 * result + payWay;
    result = 31 * result + status;
    result = 31 * result + (createDate != null ? createDate.hashCode() : 0);
    result = 31 * result + (updateDate != null ? updateDate.hashCode() : 0);
    result = 31 * result + (transportId != null ? transportId.hashCode() : 0);
    result = 31 * result + (transportStatus != null ? transportStatus.hashCode() : 0);
    return result;
  }
}
